<template>
  <div>
    <div v-if="store.isLogin">
        <el-avatar
            :src="store.user.photo"
          />
        <span>{{store.user.nickName}}({{store.user.role}})</span>
        [<span @click="logout">注销</span>]
    </div>
    <div v-else>
        <router-link to="/login">登录</router-link> 
    </div>
  </div>
</template>
<script setup>
   import {ref} from 'vue'
   import {userStore} from '../store/UserStore.js'
   const store=userStore();
  
   const logout=()=>{
      store.removeUser();
   }
</script>
<style scoped>
  div{display:flex;justify-content:center;align-items:center;line-height:60px;background:#ccc}
  
</style>